package com.education.teacher.controller;


import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.web.bind.annotation.RequestMapping;
import com.alibaba.dubbo.config.annotation.Reference;
import com.education.model.NoticeModel;
import com.education.model.ResultDo;
import com.education.service.ITeacherAnnouncement;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
/**
 * @author 张露林教师主页的控制层
 */
@Api(value = "/api/teacher", description = "报名审核")
@RestController
@RequestMapping("/api/teacher")
public class TeacherCoercionNotification {
	
	@Reference
	private ITeacherAnnouncement announcement;

	private  Logger MYLOGGER = LogManager.getLogger(TeacherCoercionNotification.class);

	/**
	 *
	 * @param currentPage
	 * @param pageSize
	 * @return
	 * @throws Exception
	 */
	@ApiOperation(notes = "/master/index", httpMethod = "GET", value = "教师主页的显示")
    @RequestMapping("/master/index")
    public ResultDo<PageInfo<NoticeModel>> selectAnnoun(Integer currentPage, Integer pageSize) throws Exception{

		PageInfo<NoticeModel> res = announcement.selectAnnouncement(currentPage, pageSize);

    	return new ResultDo<>(res);
    }
	/**
	 *
	 * @param noticeId
	 * @return
	 * @throws Exception
	 */
	@ApiOperation(notes = "/master/indexAnnouncement", httpMethod = "GET", value = "教师主页的显示详情(根据id)")
    @RequestMapping(path = "/master/indexAnnouncement",method = RequestMethod.GET)
	public ResultDo<NoticeModel> selectAnnounDetail(Integer noticeId) throws Exception{
		/*
		* 2017/8/4 王娇
		* 测试id是否传入controller
		* */
		MYLOGGER.debug("xiangshi"+noticeId);
		ResultDo<NoticeModel> res = new ResultDo<>(announcement.selectAnnouncementDetail(noticeId));
		return res;
	}
}
